import { ElMessage } from 'element-plus'

const JMessage = {
  error: (message: string, duration: number = 5000) => {
    ElMessage({
      duration: duration,
      type: 'error',
      message: message
    })
  },
  success: (message: string, duration: number = 5000) => {
    ElMessage({
      duration: duration,
      type: 'success',
      message: message
    })
  },
  warning: (message: string, duration: number = 5000) => {
    ElMessage({
      duration: duration,
      type: 'warning',
      message: message
    })
  }
}

export default JMessage
